<?php
session_start();

 $seq = array(
1=>"index.php",
2=>"class.php",
3=>"topic.php",
4=>"sys_intro.php",
5=>"level.php",
6=>"video_intro.php",
7=>"vocabulary.php",
8=>"forum.php",
9=>"video1.php",
10=>"question_type.php",
11=>"check_question_type.php",

12=>"multiple_choice1.php",
13=>"video2_mc.php",
14=>"multiple_choice2.php",
15=>"mc_answers.php",

21=>"open_question1.php",
22=>"video2_oq.php",
23=>"open_question2.php",
24=>"oq_answers.php",

41=>"video3.php",

51=>"drag_and_drop.php",
52=>"dnd_answers.php",
53=>"finish.php"
);



$url =  $_SERVER['PHP_SELF'];
$tok = strtok($url,"/");
while($tok){
	$file = $tok;
	$tok = strtok("/");		
}
$page = $_SESSION["page"];
/*
	(array_search($file,$seq)-array_search($page,$seq))==50 || 
	(array_search($file,$seq)-array_search($page,$seq))==71 || 
	(array_search($file,$seq)-array_search($page,$seq))==51
*/
/*
if((array_search($file,$seq)-array_search($page,$seq))==1 || 

	(array_search($file,$seq)-array_search($page,$seq))==10 ||
	(array_search($file,$seq)-array_search($page,$seq))==26 || 
	(array_search($file,$seq)-array_search($page,$seq))==36 ||
	(array_search($file,$seq)-array_search($page,$seq))==17 || 
	(array_search($file,$seq)-array_search($page,$seq))==27 || 
	(array_search($file,$seq)-array_search($page,$seq))==20){

	$_SESSION["page"]=$file;
	unset($_SESSION["time"]);
}
*/
$_SESSION["page"]=$file;


$page = $_SESSION["page"];
$uid = $_COOKIE['session_id'];
$session_name = $uid."_time";

//echo "current url=".$file;
//echo '</br>';
//echo "last page=".$page;
echo "<script>";
echo "var this_page = '$file';";
echo "var page = '$page';";
echo "</script>";


	

?>





<script language="JavaScript">
function next(){

<?php
		$now = array_search($page,$seq)+1;
		echo "location.replace('".$seq[$now]."');";
?>


}
</script>



<script language="JavaScript">
function direct(){
if(this_page != page){

<?php
	$now = array_search($page,$seq);
	echo "location.replace('".$seq[$now]."');";
?>
	
}
}
</script>

<script language="JavaScript">
function gotoindex(){

<?php
		echo "location.replace('index.php');";
?>


}
</script>

